﻿using System;
using System.Collections.Generic;
using System.Text;

namespace homework_5
{
    class good
    {
        private string name { get; set; }
        private double price { get; set; }
        private int ID { get; set; }

        public good(string name, double money)
        {
            this.name = name;
            this.price = price;
            this.ID = ID;
        }

        public override bool Equals(object obj)
        {
            var good = obj as good;
            return good != null &&
                   ID == good.ID;
        }

        public override int GetHashCode()
        {
            return 2108858624 + ID.GetHashCode();
        }

        public override string ToString()
        {
            return $"编号为:{ID}, 名字为:{name}, 价格是:{price}";
        }
    }
}
